import { makeDiv, waitNextFrame } from "../../../core/utils/utils";
import { BaseHUDPart } from "../base_hud_part";
import { SelectBtnGroup } from "../select_btn_group";

export class HUDBottomBar extends BaseHUDPart{
  constructor(root){
    super(root)
  }

  createElements(parent){
    this.element = makeDiv(parent, 'bottom_bar', ['bottom_bar'], ``)
  }

  initialize(){
    new SelectBtnGroup(this.root, this.root.gameState.htmlElement, '.bottom_bar', 
      [
        {
          text: '世界',
          classType: 'item',
          page: 'world_page',
          active: true,
          click(){
            // this.root.hud.parts.worldPage.movePlayerPoint();
            // this.root.hud.parts.worldPage.domAttach.internalAttach();
            this.root.playGame();
          },
          otherClick: () => {
            let flag = this.root.app.setting.currentData.leaveWorldStopGame;

            if(flag){
              this.root.stopGame();
            }
          }
        },
        {
          text: '背包',
          classType: 'item',
          page: 'backpack_page',
          click(){
            this.root.hud.parts.backpackPage.drawItems();
          }
        },
        {
          text: '队伍',
          classType: 'item',
          page: 'player_page'
        },
        {
          text: '任务',
          classType: 'item',
          page: 'task_page',
          click(){
            this.root.hud.parts.taskPage.drawTask();
          }
        },
      ]
    )
  }
}